/*景区动态*/
Ext.define('qjtravel.view.News', {
    extend: 'Ext.Container',
    xtype: 'news',
    requires:[
        'Ext.data.Store',
        'Ext.field.Search',
        "Ext.dataview.List"
    ],

    config:{
        layout:'card',
        items:
        [
            {
                xtype:'titlebar',
                docked:'top',
                title:'最新动态'
            },
            {
                xtype:'list',
                selectedCls:false,
                scrollable: true,
                store:'News',
                onItemDisclosure:true,
                itemTpl:
                    "<div>"+
                        "<img src='{picurl}' style=' float:left; width:70px; height:50px;' class='radius1'/>"+
                        "<div class='news_title font1 color2'>{name}</div>"+
                        "<div class='news_date font3 color1'>{[Ext.Date.format(new Date(parseInt(values.lasttime) * 1000), 'Y-m-d')]}</div>"+
                    "</div>",
                listeners: {
                    painted: function () {
                        var News = Ext.getStore('News');
                        //if (News.getData().length == 0) {
                            News.load({params: {ccid: '1'} });
                        //}
                    },
                    itemtap: function(list, index, element, record){
                        window.localStorage.setItem('NewsDetail_caid', record.getData().caid);
                        Ext.Viewport.animateActiveItem('newsDetail', {type: 'slide', direction: 'left'});

                    }
                }
            }
        ]
    }
});

